<div class="row justify-content-center">
    <div class="col-8">
        <form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
            <h2 id="jhi-country-heading">Create or edit a Country</h2>

            <div>
                <jhi-alert-error></jhi-alert-error>

                <div class="form-group" [hidden]="!editForm.get('id')!.value">
                    <label for="id">ID</label>
                    <input type="text" class="form-control" id="id" name="id" formControlName="id" readonly />
                </div>

                <div class="form-group">
                    <label class="form-control-label" for="field_countryName">Country Name</label>
                    <input type="text" class="form-control" name="countryName" id="field_countryName"
                           formControlName="countryName"/>
                </div>

                <div class="form-group">
                    <label class="form-control-label" for="field_region">Region</label>
                    <select class="form-control" id="field_region" name="region" formControlName="regionId">
                        <option [ngValue]="null"></option>
                        <option [ngValue]="regionOption.id" *ngFor="let regionOption of regions; trackBy: trackById">{{ regionOption.id }}</option>
                    </select>
                </div>
            </div>

            <div>
                <button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
                    <fa-icon icon="ban"></fa-icon>&nbsp;<span>Cancel</span>
                </button>

                <button type="submit" id="save-entity" [disabled]="editForm.invalid || isSaving" class="btn btn-primary">
                    <fa-icon icon="save"></fa-icon>&nbsp;<span>Save</span>
                </button>
            </div>
        </form>
    </div>
</div>
